#ifndef QOBJECTMANAGER_H
#define QOBJECTMANAGER_H

#include "qobjectproperty.h"

#include <QObject>

#include <QMap>

class AbstractCore;
class PropertyCreator;
extern void qRegPropertyCreator(PropertyCreator* creator);


class QObjectManager : public QObject
{
    Q_OBJECT
public:
    explicit QObjectManager(AbstractCore *core,QObject *parent = 0);

    QObjectProperty *getObjectProperty(QObject* object);

    QWidget *createEditor(QWidget *parent,QProperty *property);

protected:
    QProperty *createProperty(QString name,QString className);
signals:
    void    changed(QObjectProperty *obj,QProperty* pro);
public slots:
    void    propertyChanged(QProperty* pro);
    void    objectDestory();
private:
    friend class QObjectProperty;
    friend void qRegPropertyCreator(PropertyCreator* creator);
protected:
    QMap<QObject*,QObjectProperty*> m_objectPropertys;
protected:
    static QList<PropertyCreator*> m_creators;
    AbstractCore    *m_core;
};

#endif // QOBJECTMANAGER_H
